package 实践.class_07.Demo_01;

class Vehicle {
    //载客数量
    private int passengers;
    //油箱容量
    private int fuelcap;
    //每加仑多少英里（油耗值）
    private int mpg;
    //构造方法
    public Vehicle() {
    }

    public Vehicle(int passengers, int fuelcap, int mpg) {
        this.passengers = passengers;
        this.fuelcap = fuelcap;
        this.mpg = mpg;
    }

    /**
     * 获取
     * @return passengers
     */
    public int getPassengers() {
        return passengers;
    }

    /**
     * 设置
     * @param passengers
     */
    public void setPassengers(int passengers) {
        this.passengers = passengers;
    }

    /**
     * 获取
     * @return fuelcap
     */
    public int getFuelcap() {
        return fuelcap;
    }

    /**
     * 设置
     * @param fuelcap
     */
    public void setFuelcap(int fuelcap) {
        this.fuelcap = fuelcap;
    }

    /**
     * 获取
     * @return mpg
     */
    public int getMpg() {
        return mpg;
    }

    /**
     * 设置
     * @param mpg
     */
    public void setMpg(int mpg) {
        this.mpg = mpg;
    }

    public String toString() {
        return "Vehicle{passengers = " + passengers + ", fuelcap = " + fuelcap + ", mpg = " + mpg + "}";
    }

    public int range() {
        return fuelcap * mpg;
    }
    public double fuelneeded(int miles) {
        return (double) miles / mpg;
    }
}
